# -*- coding: utf-8 -*-
def afterDividedByMCD(a, b):
    ta,tb=a,b
    if abs(a)<abs(b):
        a,b=b,a
    while b!=0:
        temp=a%b
        a=b
        b=temp
    return ta/a,tb/a
def getSimplestForm((a, b)):
    a, b = afterDividedByMCD(a, b)
    if b<0:
        a*=-1
        b*=-1
    try:
        flag=0
        if a<0:
            flag=1
            a*=-1
        
        k = a / b
        a = a % b
        res = ''
        if k>0:
            if a>0:
                res = str(k)+' '+str(a)+'/'+str(b)
            elif a==0:
                res = str(k)
        elif k==0:
            if a==0:
                res = '0'
            elif a>0:
                res = str(a)+'/'+str(b)
        if flag:
            res+=')'
            res='(-'+res
        return res
    except:
        return 'Inf'
    
def cal(n1,op,n2):
    n1a, n1b = n1.split('/')
    n2a, n2b = n2.split('/')
    n1a=int(n1a)
    n2a=int(n2a)
    n1b=int(n1b)
    n2b=int(n2b)
    
    if op == '+':
        return n1a*n2b+n2a*n1b, n1b*n2b
    if op == '-':
        return n1a*n2b-n2a*n1b, n1b*n2b
    if op == '*':
        return n1a*n2a, n1b*n2b
    if op == '/':
        return n1a*n2b, n1b*n2a

ins = raw_input()
n1, n2=ins.split(' ')
sn1 = getSimplestForm((int(n1.split('/')[0]), int(n1.split('/')[1])))
sn2 = getSimplestForm((int(n2.split('/')[0]), int(n2.split('/')[1])))

for op in ['+','-','*','/']:
    print sn1,op,sn2,'=',
    print getSimplestForm(cal(n1,op,n2))